package com.frank.demo.zookeeper.curator.zk;

import org.apache.curator.framework.CuratorFramework;
import org.apache.curator.framework.recipes.cache.NodeCache;
import org.apache.curator.framework.recipes.cache.NodeCacheListener;
import org.apache.curator.framework.recipes.cache.PathChildrenCacheEvent;

/**
 * Created by zhy on 2018/5/2.
 */
public interface ZkHandle {

    /**
     * 节点变更
     *
     * @param client
     * @param event
     */
    void routeChange(CuratorFramework client, PathChildrenCacheEvent event) throws Exception;

    void routeDataUpdate(CuratorFramework client, PathChildrenCacheEvent event) throws Exception;

    String path();

    String zkAddress();

    String self();

    String selfPath();

    void shutDown() throws Exception;

    void setSelf(String name);

    /**
     * 当前节点变更
     *
     * @return
     */
    NodeCacheListener getNodeChange(NodeCache nodeCache);
}
